<!DOCTYPE html>
<html>
<head>
	<title>3-6 Vue中的样式绑定1</title>
	<style type="text/css">
		.actived{
			color: red
		}
	</style>
	<script type="text/javascript" src="../../vue.js"></script>
</head>
<body>
	<div id='root'>
		<!-- 
			方式一:给当前标签绑定上一个class:
			1.{}花括号形式是一个对象
			   v-bind:class="{actived:isActived}" 这种写法相当于 var class = {id:1}
			2.[]数组形式  
		 -->
		<div v-on:click="clickColor" 
			 v-bind:class="{actived:isActived}" 
		>  <!-- ① -->
		
		<!-- <div v-on:click="clickColor" 
			 v-bind:class="[actived]" 
		> -->  <!--②--> 
			hello world
		</div>
	</div>
	<script type="text/javascript">
		var vm = new Vue({
			el:'#root',
			data:{
				isActived:false //①
				//actived:'' //②
			},
			methods:{
				clickColor:function(){
					this.isActived = !this.isActived //①
					//this.actived = this.actived === 'actived' ? '' :'actived' ② 
				}
			}
		});
	</script>
</body>
</html>